import { defineStore } from 'pinia'
export const systemInfo = defineStore('systemInfo', {
    //unistorage: true, // 是否持久化
    state: () => {
        return {
            statusBarHeight: 0,
            windowWidth:0,
            windowHeight:0,
            screenHeight:0,
            platform:'',
            safeAreaInsets:{} as any,
            safeArea:{} as any,

        }
    },
    actions: {
        setSystemInfo({statusBarHeight,windowWidth,windowHeight,screenHeight,safeArea,safeAreaInsets,platform}:any) {
            this.statusBarHeight = statusBarHeight||this.statusBarHeight;
            this.windowWidth = windowWidth||this.windowWidth;
            this.windowHeight = windowHeight||this.windowHeight;
            this.screenHeight = screenHeight||this.screenHeight;
            this.safeAreaInsets = safeAreaInsets||this.safeAreaInsets;
            this.safeArea = safeArea||this.safeArea;
            this.platform = platform||this.platform;
        }
    }
})

// export default defineStore('userData', {
//     unistorage: true,
//     state: () => ({ id: '123456',accessToken: null}),
//     // getters: {
//     //   double: (state) => state.count * 2,
//     // },
//     actions: {
//       setUserData({id,accessToken}:any) {
//         this.id = id;
//         this.id = accessToken;
//       },
//     },
//   })

//   export const userData = defineStore('counter', () => {
//     const id = ref(11111111)
//     function setUserData() {
//       id.value = 44444444
//     }
  
//     return { id, setUserData }
//   })